<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>[`Contacts`]</title>

<link rel="stylesheet" type="text/css" href="{{$url.common}}templates/css/common.css" />
<link rel="stylesheet" type="text/css" href="{{$url.common}}templates/elements/mainscreen_complex.css" />
<link rel="stylesheet" type="text/css" href="{{$url.common}}html/res/ext/resources/css/resizable.css" />
<link rel="stylesheet" type="text/css" href="{{$url.common}}html/res/ext/resources/css/tree.css" />
<link rel="stylesheet" type="text/css" href="{{$url.common}}css/datepicker.css" />
{{csscombine file="`$url.css`contacts-index.css"}}
	{{$url.css}}reset.css
	{{$url.css}}users-common.css
	{{$url.css}}users.css
{{/csscombine}}

<script type="text/javascript" src="{{$url.common}}js/jquery.js"></script>
{{jscombine file="`$url.js`contacts-index.js"}}
	{{$url.js}}users-common.js
	{{$url.common}}js/datepicker.js
	{{$url.common}}templates/js/common.new.js
	{{$url.common}}html/res/ext/ext-small.js
	{{$url.common}}html/res/ext/build/widgets/Resizable-min.js
	{{$url.js}}complex.js
	{{$url.js}}ug.js
	{{$url.js}}contacts.js
{{/jscombine}}
{{if $user_lang=='rus'}}<script type="text/javascript" src="{{$url.common}}js/datepicker-rus.js"></script>{{/if}}
<script type="text/javascript">
	WbsCommon.setPublishedUrl("{{$url.published}}");
	Ext.BLANK_IMAGE_URL = '{{$url.common}}html/res/ext/resources/images/default/s.gif';

	document.folderNodes = {{$folders}};
	document.listNodes = {{$lists}};
	{{if $right.admin}}
		document.widgetNodes = {{$widgets}};
	{{/if}}
		
	document.contactTypes = {{$contact_types}};
	document.manageUsers = {{$right.users}};
	document.dbfields = {{$dbfields}};
	document.listfields = {{$list_fields}};
	document.photoField = {{$photoField}};
	document.contactId = {{$contact_id}};
	
	document.fields = new Array();

	
	$(document).ready(function() {
		$("#main-screen").height($(window).height() - $("#header").height());

		document.getElementById("main-screen").style.visibility = "visible";

		Toogles.init_toogle('#folders-list-toogle div.h', '#folders-list');
		Toogles.init_toogle('#lists-list-toogle div.h', '#lists-list');
		Toogles.init_toogle('#widgets-list-toogle div.h', '#widgets-list');
		
		document.app = new UGApplication({	
			right: {{$right_js}},
			currentFolderId: "{{$viewParams.currentFolderId}}",
			currentSearchId: "{{$viewParams.currentSearchId}}",
			currentListId: "{{$viewParams.currentListId}}",
			currentFormId: "{{$viewParams.currentFormId}}"
			{{if $page}}, page: {{$page}}{{/if}}
		});
		document.app.setViewSettings({itemsOnPage: {{if $viewSettings.itemsOnPage}}{{$viewSettings.itemsOnPage}}{{else}}30{{/if}}, viewmodeApplyTo: "{{if $viewSettings.viewmodeApplyTo}}{{$viewSettings.viewmodeApplyTo}}{{/if}}"});
		{{if $smarty.get.searchType}}
			document.app.search_type = '{{$smarty.get.searchType}}';
		{{/if}};
					
		init();

		{{if $smarty.get.searchType == 'simple'}}
		var string = '{{$search_string}}';
	  	document.app.doSearch(string, 1);
  	    {{/if}}

  	  	$("#top-search").keydown(function(event){
		  if (event.keyCode == 13) {
				document.app.searchByName(this.value);			  
		  }
		});

		$(window).resize();	

		$("#onload-message").fadeOut(5000, function () {$(this).remove()});
		document.app.navBar.resize();
	});
	$(window).resize(function () {
		var h = $(window).height() - $("#header").height();
		$("#main-screen").height($(window).height() - $("#header").height());
		var id = $("#nav-bar div.acc-block div.content:visible").parent().attr('id');
	});
	
	function openSearch(type, string) {
		$("#list_info").empty();
		document.app.setSearchType(type, 'search=' + string, true);
		setCookie("last_block", "search");
	}
	
</script>
</head>
<body>
<div id="header">
	<div id="toolbar_new" class="ind-tools">
		<table class="top_panel">
		<tr>
            {{if $add_contact}}			
            <td class="btn_td" width="1%">
			<div class="wbs-menu-btn-bg"><div class="wbs-menu-btn-bg_l"><span id="add-new-contact"></span></div></div>
			</td>
			{{/if}}
            <td class="search-td">
            <div class="search-container">
	            <div class="search-block">
	            	<input type="text" class="s-field" id="top-search"  value="" /><input type="button" onclick="document.app.searchByName(this.previousSibling.value);" value="[`search`]" />
	            	<span class="other-search">
	            		<a href="javascript:void(0)" onClick="openSearch('advanced');">[`Advanced search`]</a> | 
	            		<a href="javascript:void(0)" onClick="openSearch('smart');">[`Smart search`]</a>
	            	</span>
	            </div>
	        </div>
            </td>
        </tr>
        </table>
	</div>
</div>
<div id='main-screen'>
	<div class='screen-left-block'>
		<div class='nav-bar' id='nav-bar'>
			<div id="folders" class="acc-block">
				<div class="topfolders title"><ul>
						<li><a class="select-group select-folder" id="ALL-CONTACTS" href="#"><img src="{{$url.img}}i-allusers.png" width="32" height="32"/>[`All contacts`]</a></li>
						{{if $right.admin}}
						<li><a class="select-group select-folder" id="ANALYTICS-CONTACTS" href="#"><img src="{{$url.img}}i-analitics.png" width="32" height="32"/>[`Analytics`]</a></li></ul>
						{{/if}}
				</div>			
				<div class="content">
					<div class="create-new-block" id="folders-list-toogle">
						<div class="sub">
							<div class="h" style="cursor: pointer;"><span><img src="../UG/img/rarr.gif" /></span>[`Folders`]</div>
							<div style='zoom: 1; overflow: hidden' id='new-folder-btn'></div>
						</div>
					</div>				
					<div id="folders-list">
					</div>
					<div class="create-new-block" id="lists-list-toogle">
						<div class="sub">
							<div class="h" style="cursor: pointer;"><span><img src="../UG/img/rarr.gif" /></span>[`Lists`]</div>
							<div style='zoom: 1; overflow: hidden' id='new-list-btn'></div>
						</div>
					</div>
					<div id="lists-list"></div>
					{{if $right.admin}}
					<div class='create-new-block' id="widgets-list-toogle" >
						<div class="sub">
							<div class="h" style="cursor: pointer;"><span><img src="../UG/img/rarr.gif" /></span>[`Forms`]</div>
							<div style='zoom: 1; overflow: hidden' id='new-widget-btn'></div>
						</div>
					</div>				
					<div id='widgets-list' style="height:100%">
					</div>
					{{/if}}
				</div>
			</div>
		</div>
	</div>
	<div class='screen-main-block' style='margin-left: 0; height: 100%; overflow-y: auto; '>
		<div class='screen-content-block' id='screen-content-block' style='overflow-y: hidden; overflow-x: hidden; overflow: hidden;'>
			<div id='main-container'>
				<div id='main-header'>
					<div id='control-panel' class='wbs-control-panel'>
						<div id='nav-bar-expander' class='nav-bar-expander' style='margin-left: 10px'></div>			
						<div id='group-title-container'></div>			
						<div class='contacts-info'>						
							<div id='view-settings-block'>
								<input type="button" id="users-actions-btn" value="[`Actions`]" />
								<div style='text-align:right; float: left; padding-right: 3px; padding-top: 3px; width: 50px; overflow:hidden'>[`View`]:</div> 
								<div id='viewmode-selector-wrapper'></div>
								<div id='viewmode-print' class='viewmode-print'><img src="../common/templates/img/printer.gif" title='[`Print preview`]'></div>
							</div>
							<div id="list_info">{{if $message}}<div id="onload-message" class="info-message onload">{{$message}}</div>{{/if}}</div>
						</div>
						<div class="hidden wbs-dlg-content-inner" id='dlg-content'>
							<div style='margin-top: 5px; margin-bottom: 5px' id='dlg-desc'></div>
						</div>
						<div class="hidden wbs-dlg-content-inner" id='dlg-move-content'>
							<div id='dlg-move-desc' class="dlg-desc"></div>
							<select id='dlg-folders-select' size="13" style="width:100%"></select>
							<div class="add-to-list" style="display:none">
							<br />
							<div class="dlg-desc">[`Create a new list`]:</div>
							<input id="add-to-new-list" />
							</div>
						</div>
						<div class="hidden wbs-dlg-content-inner" id='dlg-export-content'></div>
						<div class="hidden wbs-dlg-content-inner" id='dlg-sendsms-content'></div>
					</div>
				</div>
				<div id='main-content'>{{$content}}</div>
			</div>
		</div>
	</div>
</div>

</body>
</html>